<?php
namespace app\common\order\model;

use app\common\system\logic\UserLogic;
use think\Model;
use think\model\concern\SoftDelete;

class SuborderUse extends Model
{
    use SoftDelete;
    protected $defaultSoftDelete = 0;
    
    protected $type = [];

    public function getUserAttr($value, $data) {
        $userLogic = new UserLogic();
        return $userLogic->getUser($data['user_id'], ['id', 'realname', 'work_wechat']);
    }

    public function getSuborderAttr($value, $data) {
        $model = new SuborderBom();
        $suborder = $model->where('id', $data['suborder_id'])->find();

        return $suborder;
    }
}